#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPushButton>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowTitle("上课摸鱼器");
    this->setFixedSize(800,600);
    QPushButton * startbtn = new QPushButton("开      始",this);
    startbtn->resize(300,100);
    startbtn->move(this->width()*0.5-startbtn->width()*0.5,this->height()*0.35);
    QPushButton * helpbtn = new QPushButton("帮      助",this);
    helpbtn->resize(300,100);
    helpbtn->move(this->width()*0.5-startbtn->width()*0.5,this->height()*0.55);
    QPushButton * quitbtn = new QPushButton("退      出",this);
    quitbtn->resize(300,100);
    quitbtn->move(this->width()*0.5-startbtn->width()*0.5,this->height()*0.75);
    chooselevel = new levelchoose;
    connect(chooselevel,&levelchoose::levelsceneBack,this,[=](){
        chooselevel->hide();
        this->show();
    });
    connect(startbtn,&QPushButton::clicked,[=](){
        this->hide();
        chooselevel->show();
    });
    connect(quitbtn,&QPushButton::clicked,[=](){
        this->close();
    });
    connect(ui->actionquit,&QAction::triggered,[=](){
        emit quitbtn->clicked();
    });
    connect(ui->actionnew,&QAction::triggered,[=](){
        emit startbtn->clicked();
    });
}

MainWindow::~MainWindow()
{
    delete ui;
}
